home *** CD-ROM | disk | FTP | other *** search
- //
- // COPWalker AI file
- //
- // Activation behavior:
- // Walker starts out, finds the closest building to activate, goes to it and activates it,
- // then repeats until its lifespan expires, then they disappear into their home
- // and slack for awhile.
- //
- // Visit behavior:
- // Walker starts out, finds a building which provides the right service, goes to it and visits,
- // then returns home and notes what service level it obtained.
- //
- // Activation actions:
- // StartActivationRounds - sets start of lifespan (goal data)
- // FindBuildingToActivate - finds the closest building, sets it as the target, and sets a location goal including facing
- // (after which unit goes through generic movement actions, ending up at ReacquireGoal)
- // ActivateBuilding - Performs fidget animates for a set amount of time then activates the building
- // ShouldIActivateAnother - nothing hardcoded - logic for this action is in this file
- // GoHome - sets a location goal of their home building
- // (after which unit goes through generic movement actions, ending up at ReacquireGoal)
- //
- // Visit actions:
- // StartVisiting - sets start time
- // FindBuildingToVisit - finds the closest appropriate building, sets it as the target, and sets a location goal including facing
- // (after which unit goes through generic movement actions, ending up at ReacquireGoal)
- // VisitBuilding - Performs fidget animates for a set amount of time, getting best service amount from the building
- // ShouldIVisitAnother - nothing hardcoded - logic for this action is in this file
- //
- // Activation triggers:
- // LifespanExpired - true when the lifespan has expired
- // BuildingActivated - true if building is activated or invalid
- // AtBuildingToActivate - true if we're at our target building and it needs activated
- //
- // Visit triggers:
- // VisitorGotService - true if walker has received the desired service
- // AtBuildingToVisit - true if we're at a building that provides the desired service
-
- #include("Gather.tai")
-
- //////////////////////////
- // Building & Repairing //
- //////////////////////////
-
- // assumption here is that there are still some waypoints left
- CheckBuildSiteValidity
- {
- allof(BuildingRepaired,GoalIsBuild,BuildQueueEmpty) true(TaskSmartCitizen)
- anyof(BuildingDestroyed,BuildingRepaired) true(Idle)
- BuildSiteValid true(Advance) false(CheckOwner)
- }
-
- // assumption here is that there are still some waypoints left
- CheckBuildSiteVisibility
- {
- allof(BuildingRepaired,GoalIsBuild,BuildQueueEmpty) true(TaskSmartCitizen)
- anyof(BuildingDestroyed,BuildingRepaired) true(Idle)
- BuildSiteVisible true(CheckBuildSiteValidity) false(Advance)
- }
-
- CheckOwner
- {
- OwnerIsHuman true(ConvertToLocationGoal)
- OwnerIsComputer true(WaitForBuildSiteToClear)
- }
-
- // assumption here is that there are no more waypoints
- CheckRepairSiteAccessibility
- {
- allof(BuildingRepaired,GoalIsBuild,BuildQueueEmpty) true(TaskSmartCitizen)
- anyof(BuildingDestroyed,BuildingRepaired) true(Idle)
- RepairIsSpecialUnit true(ChangeTargetForSpecialRepair)
- RepairSiteInRange false(Idle)
- BuildSiteValid true(WaitForBuildSiteToClear) false(CheckOwner)
- NextWaypointRetrieved false(PrepareToMove)
- }
-
- ConvertToLocationGoal
- {
- GoalIsLocation true(PrepareToMove)
- }
-
- MoveToRepairSite
- {
- allof(BuildingRepaired,GoalIsBuild,BuildQueueEmpty) true(TaskSmartCitizen)
- anyof(BuildingDestroyed,BuildingRepaired) true(Idle)
- RepairSiteInRange false(PrepareToMove)
- BuildSiteValid true(WaitForBuildSiteToClear) false(ConvertToLocationGoal)
- }
-
- RepairBuilding
- {
- BuildingRepaired true(CheckToMoveIn)
- anyof(BuildingRepaired,BuildingDestroyed) true(Idle)
- anyof(CannotAffordRepair,BuildingNotPaidFor) true(InsufficientResources)
- allof(TakingLightDamage,OwnerIsComputer) true(UnderAttack)
- }
-
- CheckToMoveIn
- {
- ShouldMoveIn true(MoveToNewHome) false(Idle)
- }
-
- InsufficientResources
- {
- AlwaysTrue true(Idle)
- }
-
- ChangeTargetForSpecialRepair
- {
- AlwaysTrue true(MoveToRepairSite)
- }
-
- TaskSmartCitizen
- {
- SmartTaskNotAssigned true(Idle)
- }
-
- WaitForBuildSiteToClear
- {
- allof(BuildingRepaired,GoalIsBuild,BuildQueueEmpty) true(TaskSmartCitizen)
- anyof(BuildingRepaired,BuildingDestroyed) true(Idle)
- RepairIsSpecialUnit true(ChangeTargetForSpecialRepair)
- BuildSiteClear true(RepairBuilding)
- }
-
-
- /////////////////
- // Other Stuff //
- /////////////////
-
- Idle
- {
- BuildingInBuildQueue true(MoveToRepairSite)
- TakingLightDamage true(FleeDanger)
- }
-
- #include("Generic Attack.tai")
-
- // important that this go BEFORE including generic movement
- GetNextMoveWaypoint
- {
- allof(GoalIsResource,ResourceTargetIsTree,ResourceInRange) true(GatherResource)
- allof(GoalIsStorage,StorageInRange) true(AddResourceToStorage)
- ShouldMoveToNextAutoWaypoint true(GetNextAutoWaypoint)
- allof(GoalIsRepairSite,NextWaypointRetrieved) true(CheckBuildSiteVisibility)
- allof(GoalIsWaitingArea,CanUseThisTileAsWaitingArea) true(MoveToWaitingArea)
- }
-
- #include("Generic Movement.tai")
-
- #include("Generic Death.tai")
-
- /////////////////////////////
- // Visiting and activating //
- /////////////////////////////
-
-
- StartActivationRounds
- {
- LifespanExpired true(GoHome) false(FindBuildingToActivate)
- }
-
- StartVisiting
- {
- LifespanExpired true(GoHome) false(FindBuildingToVisit)
- }
-
- ReacquireGoal
- {
- allof(GoalIsActivate,AtBuildingToActivate) true(ActivateBuilding)
- allof(GoalIsVisit,AtBuildingToVisit) true(VisitBuilding)
- GoalIsActivate true(Idle)
- GoalIsRepairSite true(CheckRepairSiteAccessibility)
- NewBoatLocation true(GoToBoat)
- allof(GoalIsProduceGoods,JustStandingThere) true(GoHome)
- }
-
- ActivateBuilding
- {
- BuildingActivated true(ShouldIActivateAnother)
- }
-
- VisitBuilding
- {
- VisitorGotService true(ShouldIVisitAnother)
- AtBuildingToVisit false(ShouldIVisitAnother)
- }
-
-
- ShouldIActivateAnother
- {
- LifespanExpired true(GoHome) false(FindBuildingToActivate)
- }
-
- ShouldIVisitAnother
- {
- anyof(VisitorGotService,LifespanExpired) true(GoHome) false(FindBuildingToVisit)
- }
-
- TendCrops
- {
- LifespanExpired true(Idle)
- }
-
- PlantCrops
- {
- AlwaysTrue true(ReacquireGoal)
- }
-
- HarvestCrops
- {
- AlwaysTrue true(ReacquireGoal)
- }
-
- ProduceGoods
- {
- AtHome false(GoHome)
- ReachedMaximumProduction true(Idle)
- }
-
- ArriveAtShop
- {
- WantToBuySomethingHere true(Barter)
- anyof(IsEvening,IsNight) true(GoHome) false(FindPlaceToShop)
- }
-
- ArriveHome
- {
- AlwaysTrue true(Idle)
- }
-
- Barter
- {
- FinishedBartering true(FinishBarterTransaction)
- IsNight true(GoHome)
- }
-
- // Note: Home may mean 'shop' for servants
- FinishBarterTransaction
- {
- GoalIsVault true(GoHome)
- anyof(IsEvening,IsNight) true(GoHome) false(FindPlaceToShop)
- }
-
- Migrate
- {
- TakingLightDamage true(FleeDanger)
- }
-
- WaitToMigrate
- {
- BuildingBuilt true(Migrate)
- }
-
- GoToSchool
- {
- LifespanExpired true(GoHome)
- }
-
- Beg
- {
- LifespanExpired true(SearchForBegTarget)
- }
-
- GiveToBeggar
- {
- LifespanExpired true(FinishGivingToBeggar)
- }
-
- FinishGivingToBeggar
- {
- TakingLightDamage true(FleeDanger)
- }
-
- BuildShack
- {
- TakingLightDamage true(FleeDanger)
- }
-
- PlanMovement
- {
- TakingLightDamage true(FleeDanger)
- }
-
- InteriorAdvance
- {
- TakingLightDamage true(FleeDanger)
- }
-
- MakeTreasure
- {
- TakingLightDamage true(FleeDanger)
- }
-
- Follow
- {
- TargetInRange true(WaitToFollow)
- }
-
- WaitToFollow
- {
- TargetInRange false(Follow)
- }
-
- BuyFood
- {
- TakingLightDamage true(FleeDanger)
- }
-
- HaulSled
- {
- TakingLightDamage true(FleeDanger)
- }
-
- MoveBricks
- {
- TakingLightDamage true(FleeDanger)
- }
-
- MoveToSled
- {
- TakingLightDamage true(FleeDanger)
- }
-
- Quarry
- {
- TakingLightDamage true(FleeDanger)
- }
-
- PlanRiverCrossing
- {
- JustStandingThere true(ReacquireGoal)
- }
-
- BuildBoat
- {
- TakingLightDamage true(FleeDanger)
- }
-
- BoatBuilt
- {
- TakingLightDamage true(FleeDanger)
- }
-
- ReadyForBoarding
- {
- TakingLightDamage true(FleeDanger)
- }
-
- StartPatrol
- {
- TakingLightDamage true(UnderAttack)
- }
-
- Chat
- {
- StillChatting false(TurnBackToWork)
- FacingChatPartner false(TurnToChatPartner)
- }
-
- TurnToChatPartner
- {
- FacingChatPartner true(Chat)
- }
-
- TurnBackToWork
- {
- TurnComplete true(ReacquireGoal)
- }
-
- GoHome
- {
- JustStandingThere true(ReacquireGoal)
- }
-
- WaitForHaulers
- {
- HaulersArrived true(StartBeingHauled)
- }